package com.xzl.org.learning_situation_analysis.service.Impl;

import com.xzl.org.learning_situation_analysis.dao.QuestionMapper;
import com.xzl.org.learning_situation_analysis.entity.Question;
import com.xzl.org.learning_situation_analysis.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author 夏智力
 * @FileName QuestionServiceImpl
 * @date 2022/4/12 21:50
 * @Software: IntelliJ IDEA
 */
@Service
public class QuestionServiceImpl implements QuestionService {

    @Autowired
    private QuestionMapper questionMapper;
    @Override
    public int insertQuestion(Question question) {
        question.setReleaseTime(new Date(System.currentTimeMillis()));
        return questionMapper.insertQuestion(question);
    }

    @Override
    public List<Question> selectByPaperId(int paperId) {
        return questionMapper.selectByPaperId(paperId);
    }

    @Override
    public List<Question> selectByPaperIdAndTypeId(int paperId, int typeId) {
        return questionMapper.selectByPaperIdAndTypeId(paperId, typeId);
    }
}
